package com.project.service.Impl;

import com.project.handlChain.HomeRichHandleChain;
import com.project.mapper.RiskControllerMapper;
import com.project.pojo.RiskController;
import com.project.service.HomeService;
import com.project.utils.ErrorMessage;
import com.project.utils.ResponseData;
import com.project.utils.ResponseDataUtil;
import com.project.vo.HomeMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
@Service
public class HomeServiceImpl implements HomeService {

    private List<RiskController> list=new ArrayList<>();

    List<ErrorMessage> errorMessageList=new ArrayList<>();

    @Autowired
    HomeRichHandleChain homeRichHandleChain;

    @Autowired
    RiskControllerMapper riskControllerMapper;

    @Override
    public List<ErrorMessage> homeRiskAssess(HomeMessage homeMessage) {

        list=riskControllerMapper.getByInsuranceTypeRiskControllers(1);

        homeRichHandleChain.handle(homeMessage,list,errorMessageList);
        if (errorMessageList.size()>0){

            return errorMessageList;
        }

        return null;
    }
}
